package god;

public class J15Ch05Printer {
	public static void main(String[] args) {
		Printer p = new Printer();
		System.out.println( p.print() );

		InkPrinter ip = new InkPrinter();
		System.out.println( ip.print() );
		
		LazerPrinter lp = new LazerPrinter();
		System.out.println( lp.print() );
	}
}

class Printer {
	private String maker = "Z101";
	private String model = "S";
	private String interfaces = "parallel";
	private int counts = 0;
	private int remains = 100;
	protected String result = "";
	
	public String getMaker() { return maker; }
	public void setMaker(String maker) { this.maker = maker; }
	
	public String getModel() { return model; }
	public void setModel(String model) { this.model = model; }
	
	public String getInterfaces() { return interfaces; }
	public void setInterfaces(String interfaces) { this.interfaces = interfaces; }
	
	public int getCounts() { return counts; }
 	public void setCounts(int counts) { this.counts = counts; }
 	
	public int getemains() { return remains; }
	public void setRemains(int remains) { this.remains = remains; }
	
	public String getResult() { return result; }
	public void setResult(String result) { this.result = result; }

	public String print() {
		System.out.println( "프린트 출력완료!!");
		remains -= 1;
		result += "종이 잔량 : " + remains;
		return result;
	}
}

class InkPrinter extends Printer {
	private int ink = 100;	
	
	public int getInk() { return ink; }
	public void setInk(int ink) { this.ink = ink; }

	@Override // 어노테이션. 주석 : 컴파일러를 위한 주석
	// 부모 클래스에서 상속 받아서 재정의 했다고 알려주기 위해
	// 이 코드가 잘 작성되었는지 확인하기 위한 용도. 인터페이스 배울 때 자세히
	public String print() {
		System.out.println( "프린트 출력완료!!");
		ink -= 1;
		result += "잉크 잔량 : " + ink;
		return result;
	}
}

class LazerPrinter extends Printer {
	private int toner = 100;

	public int getToner() { return toner; }
	public void setToner(int toner) { this.toner = toner; }

	@Override
	public String print() {
		System.out.println( "프린트 출력완료!!");
		toner -= 1;
		result += "토너 잔량 : " + toner;
		return result;
	}
}